import { VxeFormItemProps, VxeGridPropTypes } from '@gui-pkg/antdcomponents';
import dayjs from 'dayjs';

export const columns: VxeGridPropTypes.Columns = [
  {
    title: '预警类型',
    field: 'methodType',
    align: 'center',
    formatter: ({cellValue}) => {
      let text = '站点预警';
      if (cellValue == 1) {
        text = '站点预警'
      }else if (cellValue == 2) {
        text = '叫应预警'
      }
      return text;
    },
  },
   {
    title: '站点名称',
    field: 'stnm',
    align: 'center',
  },
  {
    title: '发送时间',
    field: 'createTime',
    align: 'center',
    formatter: ({cellValue}) => {
      const data = dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss')
      return data;
    }
  },

  {
    title: '预警发生时间',
    field: 'tm',
    align: 'center',
    formatter: ({cellValue}) => {
      const data = dayjs(cellValue).format('YYYY-MM-DD HH:mm:ss')
      return data;
    }
  },
  {
    title: '发送对象',
    field: 'target',
    align: 'center',
    showOverflow: true,
  },
  {
    title: '预警级别',
    field: 'warnLevel',
    align: 'center',
    formatter: ({cellValue}) => {
      let text = '';
      if (cellValue == 1) {
        text = '极高风险'
      }else if (cellValue == 2) {
        text = '高风险'
      }
      return text;
    },
  },
  {
    title: '短信内容、电话内容',
    field: 'content',
    align: 'center',
    width:500,
    showOverflow: true,
  },
  {
    title: '短信发送记录（成功/总数）',
    field: 'process2',
    align: 'center',
  },
  {
    title: '电话拨打记录（成功/总数）',
    field: 'process1',
    align: 'center',
  },
  {
    title: '操作',
    align: 'center',
    slots: { default: 'action' },
    fixed: 'right',
  },
];

export const searchFormSchema: VxeFormItemProps[] = [
  {
    field: 'sendTime',
    title: '发送时间',
    itemRender: {
      name: 'ARangePicker',
      props: {
        format: 'YYYY-MM-DD HH:mm:ss',
        showTime: true
      },
    },
    span: 6,
  },
  {
    span: 18,
    align: 'right',
    className: '!pr-0',
    itemRender: {
      name: 'AButtonGroup',
      children: [
        {
          props: { type: 'primary', content: '查询', htmlType: 'submit' },
          attrs: { class: 'mr-2' },
        },
        { props: { type: 'default', htmlType: 'reset', content: '重置' } },
      ],
    },
  },
];
